import { request } from "@/utils/request.js";

// 上传打卡记录
export const doSign = data => {
	return request({
	    url: `/ht-nonrealtime-gameservice/activity/clockIn`,
	    method: 'POST',
		data
	})
}

// 获取用户打卡记录
export const vote4Others = data => {
	return request({
	    url: `/ht-nonrealtime-gameservice/activity/joinVote`,
	    method: 'POST',
		data
	})
}

// 获取用户打卡记录
export const getUserSignRecord = id => {
	return request({
	    url: `/ht-nonrealtime-gameservice/activity/clockIn/record?activityId=${id}`,
	    method: 'GET'
	})
}

// 发起投票
export const addUserVoteApi = data => {
	return request({
	    url: `/ht-nonrealtime-gameservice/activity/initiateVote`,
	    method: 'POST',
	    data
	})
}

// 获取活动投票图文列表
export const getUserVoteListApi = data => {
	return request({
	    url: `/ht-nonrealtime-gameservice/activity/voteUserList`,
	    method: 'POST',
	    data
	})
}

/**
 * 获取投票活动列表
 * @param data
 * @returns {*}
 */
export const getVoteActivityListApi = data => {
	return request({
	    url: `/ht-nonrealtime-gameservice/activity/voteList`,
	    method: 'POST',
	    data
	})
}

/**
 * 获取打卡挑战列表
 * @param data
 * @returns {*}
 */
export const getSignActivityListApi = data => {
	return request({
	    url: `/ht-nonrealtime-gameservice/activity/clockInList`,
	    method: 'POST',
	    data
	})
}

/**
 * 按照type获取活动列表
 * @param type
 * @returns {*}
 */
export const getActivityListDataApi = params => {
    return request({
        url: `/ht-nonrealtime-gameservice/activity/activityList`,
        method: 'POST',
        data:params
    })
}

/**
 * 获取活动详情
 * @param id
 * @returns {*}
 */
export const getActivityDetailApi = id => {
    return request({
        url: `/ht-nonrealtime-gameservice/activity/detail/${id}`,
        method: 'GET',
        type: 'application/x-www-form-urlencoded'
    })
}

export const getActivityDetailTicketTotalApi = id => {
    return request({
        url: `/ht-nonrealtime-gameservice/activity/detail/ticketTotal/${id}`,
        method: 'GET',
        type: 'application/x-www-form-urlencoded'
    })
}

/**
 * 用户提交活动报名表
 * @param form
 * @returns {Promise<unknown>}
 */
export const userSubmitSignUpActivityFormApi = form => {
    return request({
        url: '/ht-nonrealtime-gameservice/activity/joinActivity',
        method: 'POST',
        data: {...form}
    })
}
/**
 * 获取我的报名列表
 * @returns {Promise<unknown>}
 * @param params
 */
export const getMySignUpActivityListApi = params => {
    return request({
        url: `/ht-nonrealtime-gameservice/activity/myActivity`,
        method: 'POST',
        data:params
    })
}
/**
 * 用户扫码签到
 * @param id
 * @returns {Promise<unknown>}
 */
export const userSignActivityApi = id => {
    return request({
        url:`/ht-nonrealtime-gameservice/activity/singIn?activityId=${id}`,
        method: 'GET'
    })
}

export const getUserSignUpActivityDetailApi = activityId => {
    return request({
        url:`/ht-nonrealtime-gameservice/activity/myActivityInfo/${activityId}`,
        method: 'GET',
    })
}
export const isSignUpApi = activityId => {
    return request({
        url:`/ht-nonrealtime-gameservice/activity/isSignUp/${activityId}`,
        method: 'GET',
    })
}
export const downloadFileApi = data => {
    return request({
        url:`/ht-nonrealtime-gameservice/integral/downloadFile`,
        method: 'POST',
        type: 'application/x-www-form-urlencoded',
        data: data,
    })
}

export const getActivityRecallListApi = params => {
    return request({
        url: `/ht-nonrealtime-gameservice/activity/recall/list`,
        method: 'POST',
        data: params
    })
}

export const getActivityRecalldetailApi = activityId => {
    return request({
        url: `/ht-nonrealtime-gameservice/activity/recall/detail/${activityId}`,
        method: 'GET'
    })
}
